import java.util.concurrent.atomic.AtomicInteger;

/**
 * @auther:Alessio
 * @date:2021/1/11
 */
public class CASDemo {
    public static void main(String[] args) {

        AtomicInteger atomicInteger=new AtomicInteger(5);

        System.out.println(atomicInteger.compareAndSet(5,2019)+"  current value: "+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5,1024)+"  current value: "+atomicInteger.get());

        atomicInteger.getAndIncrement();
    }
}
